package com.app.pojo;

import com.app.utils.Judges;

public class MyPath {
    public String diskId,detailPath,sourcePath;
    /**
     *
     * @param sourcePath path 以“/”开头则访问自己的网盘，以userId开头则访问对应网盘，path不允许有./存在
     */
    public MyPath(String sourcePath){
        sourcePath=sourcePath.replace("\\","/");
        this.sourcePath=sourcePath;
        if (sourcePath.startsWith("/")) detailPath=sourcePath;
        else {
            int i = sourcePath.indexOf('/');
            diskId=sourcePath.substring(0,i);
            detailPath=sourcePath.substring(i);
        }
    }
    public boolean isAvailable(){
        return Judges.judgePath(sourcePath);
    }


    @Override
    public String toString() {
        return sourcePath;
    }
}
